@extends('layout.home.master')
@section('content')
    <div class="row mt-2">
        <div class="col-9">
            <div class="card-header mb-2" style="background: white">
                <div class="row align-items-center" >
                    <div class="col" >
                        <!-- Title -->
                        <h4 class="card-header-title">
                          添加话题
                        </h4>
                    </div>
                </div> <!-- / .row -->
            </div>
            {{--<hr>--}}
            <div class="card card-body p-5">
                <form action="{{route('home.topic.store')}}" method="post">
                    @csrf
                    <div class="form-group">
                        <label for="" >选择话题标签</label>
                        <select id="inputState" class="form-control" name="column_title">
                            @foreach($columns=(new \App\Model\Column())->get() as$column )
                                <option selected>
                                    {{--<i class="{{$column->icon}}"></i>--}}
                                    {{$column->title}}</option>
                            @endforeach

                        </select>
                    </div>
                    <div class="form-group">
                        <label for="" >话题标题</label>
                        <input type="text" class="form-control" name="title" value="" >
                    </div>
                    <div class="form-group">
                        <label for="exampleFormControlTextarea1">话题内容</label>
                        <div id="editormd"><textarea name="content" style="display:none;"></textarea>
                        </div>
                        </textarea>
                    </div>
                    <button type="submit" class="btn btn-info">添加话题</button>
                </form>
            </div>
        </div>
        <div class="col-sm-3">
            <div class="card">
                <div class="card-header">
                    {{auth()->user()->name}}
                </div>
                <div class="card-body text-center">
                    <div class="avatar avatar-xl">
                        <img src="{{auth()->user()->icon}}" alt="" class="avatar-img rounded-circle">
                    </div>
                </div>
                {{--<div class="card-footer">--}}
                    {{--<button class="btn btn-white btn-block"><span class="fe fe-plus "></span>关注</button>--}}
                {{--</div>--}}
            </div>
        </div>
    </div>
    @endsection
        @push('js')
    <script>
        require(['hdjs'], function (hdjs) {
            hdjs.editormd("editormd", {
                width: '100%',
                height: 300,
                toolbarIcons : function() {
                    return [
                        "bold", "del", "italic", "quote","|",
                        "list-ul", "list-ol", "hr", "|",
                        "link", "hdimage", "code-block", "|",
                        "watch", "preview", "fullscreen"
                    ]
                },
                //editor.md库位置
                path: "{{asset('org/hdjs')}}/package/editor.md/lib/"
            });
        });
    </script>
    @endpush
